<?php

class MDiaDiemLan extends CI_Model
{

	function thongtindiadiemlan($maddl)
	{
		$this->db->where('maddl', $maddl);
		return $this->db->get('diadiemlan')->row();
	}
	
	function danhsachdiadiemlanmoinhat()
	{
		$this->db->order_by('maddl', 'desc');
		$this->db->where('hienthi', 'true');
		return $this->db->get('diadiemlan', 8, 0)->result();
	}
	
	function danhsachdiadiemlan4()
	{
		$this->db->order_by('maddl', 'desc');
		$this->db->where('hienthi', 'true');
		return $this->db->get('diadiemlan', 4, 0)->result();
	}
	
	function xoaddl($maddl)
	{
		$this->db->where('maddl', $maddl);
		$this->db->delete('diadiemlan');
	}
	
	function themddl($tenddl, $hinh, $mota, $hienthi)
	{
		$this->db->set('tenddl', $tenddl);
		$this->db->set('hinh', $hinh);
		$this->db->set('mota', $mota);
		$this->db->set('hienthi', $hienthi);
		$this->db->insert('diadiemlan');
	}
	
	function capnhatddl($maddl, $tenddl, $hinh, $mota, $hienthi)
	{
		$this->db->where('maddl', $maddl);
		$this->db->set('tenddl', $tenddl);
		$this->db->set('hinh', $hinh);
		$this->db->set('mota', $mota);
		$this->db->set('hienthi', $hienthi);
		$this->db->update('diadiemlan');
	}
	
	function danhsachdiadiemlan()
	{
		
				
		return $this->db->get('diadiemlan')->result();
	}
}
?>